/* Socket connecting.
 * This file is part of AGet. See main.h to get more info.
 */
#ifndef _WUXI_INET_
#define _WUXI_INET_

#include <sys/types.h>
#include <sys/socket.h>

/**
 * connect with timeout-detecting.
 *
 * @param int sck, socket file descriptor.
 * @param const struct sockaddr* servaddr, socket address struct.
 * @param size_t len, byte size of servaddr.
 * @param int sec, timeout seconds. 0 indicates no limit.
 *
 * @return int. It returns 0 if succeed, otherwise return -1 and the errno is
 *         set appropriately to indicate the error.
 */
int conn_timeout(int sck, const struct sockaddr* servaddr, size_t len, int sec);



#endif
